﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ibatis.apache.org/mapping" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="sqlMap">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="alias">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="typeAlias">
                <xs:complexType>
                  <xs:attribute name="alias" type="xs:string" use="required" />
                  <xs:attribute name="assembly" type="xs:string" use="required" />
                  <xs:attribute name="type" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="resultMaps">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="resultMap">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" name="constructor">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="argument">
                            <xs:complexType>
                              <xs:attribute name="argumentName" type="xs:string" use="required" />
                              <xs:attribute name="column" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element maxOccurs="unbounded" name="result">
                      <xs:complexType>
                        <xs:attribute name="property" type="xs:string" use="required" />
                        <xs:attribute name="column" type="xs:string" use="required" />
                        <xs:attribute name="nullValue" type="xs:string" use="optional" />
                        <xs:attribute name="dbType" type="xs:string" use="optional" />
                        <xs:attribute name="type" type="xs:string" use="optional" />
                        <xs:attribute name="typeHandler" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:string" use="required" />
                  <xs:attribute name="class" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" name="resultMaps">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="resultMap">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="result">
                            <xs:complexType>
                              <xs:attribute name="property" type="xs:string" use="required" />
                              <xs:attribute name="column" type="xs:string" use="optional" />
                              <xs:attribute name="dbType" type="xs:string" use="optional" />
                              <xs:attribute name="typeHandler" type="xs:string" use="optional" />
                              <xs:attribute name="type" type="xs:string" use="optional" />
                              <xs:attribute name="select" type="xs:string" use="optional" />
                              <xs:attribute name="resultMapping" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" name="discriminator">
                            <xs:complexType>
                              <xs:attribute name="column" type="xs:string" use="required" />
                              <xs:attribute name="type" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="subMap">
                            <xs:complexType>
                              <xs:attribute name="value" type="xs:string" use="required" />
                              <xs:attribute name="resultMapping" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:string" use="required" />
                        <xs:attribute name="class" type="xs:string" use="required" />
                        <xs:attribute name="extends" type="xs:string" use="optional" />
                        <xs:attribute name="groupBy" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" name="cacheModel">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="flushInterval">
                <xs:complexType>
                  <xs:attribute name="hours" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" name="flushOnExecute">
                <xs:complexType>
                  <xs:attribute name="statement" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element name="property">
                <xs:complexType>
                  <xs:attribute name="name" type="xs:string" use="required" />
                  <xs:attribute name="value" type="xs:unsignedShort" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:string" use="required" />
            <xs:attribute name="implementation" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
        <xs:element name="parameterMaps">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="parameterMap">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="parameter">
                      <xs:complexType>
                        <xs:attribute name="property" type="xs:string" use="required" />
                        <xs:attribute name="direction" type="xs:string" use="optional" />
                        <xs:attribute name="column" type="xs:string" use="optional" />
                        <xs:attribute name="dbType" type="xs:string" use="optional" />
                        <xs:attribute name="size" type="xs:unsignedByte" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:string" use="required" />
                  <xs:attribute name="class" type="xs:string" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="statements">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="sql">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="isPropertyAvailable">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="isNotEmpty">
                            <xs:complexType mixed="true">
                              <xs:sequence minOccurs="0">
                                <xs:element name="isNotEqual">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute name="prepend" type="xs:string" use="required" />
                                        <xs:attribute name="property" type="xs:string" use="required" />
                                        <xs:attribute name="compareValue" type="xs:unsignedByte" use="required" />
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute name="prepend" type="xs:string" use="required" />
                              <xs:attribute name="property" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="prepend" type="xs:string" use="required" />
                        <xs:attribute name="property" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" name="insert">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="isPropertyAvailable">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="isNotEmpty">
                            <xs:complexType mixed="true">
                              <xs:sequence minOccurs="0">
                                <xs:element name="isNotEqual">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute name="prepend" type="xs:string" use="required" />
                                        <xs:attribute name="property" type="xs:string" use="required" />
                                        <xs:attribute name="compareValue" type="xs:unsignedByte" use="required" />
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute name="prepend" type="xs:string" use="required" />
                              <xs:attribute name="property" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="prepend" type="xs:string" use="required" />
                        <xs:attribute name="property" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" name="include">
                      <xs:complexType>
                        <xs:attribute name="refid" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:string" use="required" />
                  <xs:attribute name="parameterClass" type="xs:string" use="required" />
                  <xs:attribute name="parameterMap" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" name="update">
                <xs:complexType mixed="true">
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="include">
                      <xs:complexType>
                        <xs:attribute name="refid" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:string" use="required" />
                  <xs:attribute name="parameterClass" type="xs:string" use="required" />
                  <xs:attribute name="extends" type="xs:string" use="optional" />
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" name="delete">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="id" type="xs:string" use="required" />
                      <xs:attribute name="parameterClass" type="xs:string" use="required" />
                      <xs:attribute name="extends" type="xs:string" use="optional" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" name="select">
                <xs:complexType mixed="true">
                  <xs:sequence minOccurs="0">
                    <xs:element name="iterate">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="open" type="xs:string" use="required" />
                            <xs:attribute name="close" type="xs:string" use="required" />
                            <xs:attribute name="conjunction" type="xs:string" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:string" use="required" />
                  <xs:attribute name="parameterClass" type="xs:string" use="required" />
                  <xs:attribute name="resultClass" type="xs:string" use="required" />
                  <xs:attribute name="listClass" type="xs:string" use="optional" />
                  <xs:attribute name="parameterMap" type="xs:string" use="optional" />
                  <xs:attribute name="resultMap" type="xs:string" use="optional" />
                  <xs:attribute name="cacheModel" type="xs:string" use="optional" />
                  <xs:attribute name="extends" type="xs:string" use="optional" />
                </xs:complexType>
              </xs:element>
              <xs:element name="procedure">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="id" type="xs:string" use="required" />
                      <xs:attribute name="parameterMap" type="xs:string" use="required" />
                      <xs:attribute name="resultClass" type="xs:string" use="required" />
                      <xs:attribute name="resultMap" type="xs:string" use="required" />
                      <xs:attribute name="cacheModel" type="xs:string" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="namespace" type="xs:string" use="required" />
    </xs:complexType>
  </xs:element>
</xs:schema>